<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QRunnable Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QRunnable Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QRunnable class is the base class for all runnable objects.
<a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qrunnable.html#QRunnable">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qrunnable.html#QRunnable-2">__init__</a></b> (<i>self</i>, QRunnable)</li><li><div class="fn" />bool <b><a href="qrunnable.html#autoDelete">autoDelete</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qrunnable.html#run">run</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qrunnable.html#setAutoDelete">setAutoDelete</a></b> (<i>self</i>, bool&#160;<i>_autoDelete</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QRunnable class is the base class for all runnable
objects.</p>
<p>The QRunnable class is an interface for representing a task or
piece of code that needs to be executed, represented by your
reimplementation of the <a href="qrunnable.html#run">run</a>()
function.</p>
<p>You can use <a href="qthreadpool.html">QThreadPool</a> to
execute your code in a separate thread. <a href="qthreadpool.html">QThreadPool</a> deletes the QRunnable
automatically if <a href="qrunnable.html#autoDelete">autoDelete</a>() returns true (the
default). Use <a href="qrunnable.html#setAutoDelete">setAutoDelete</a>() to change the
auto-deletion flag.</p>
<p><a href="qthreadpool.html">QThreadPool</a> supports executing
the same QRunnable more than once by calling
QThreadPool.tryStart(this) from within the <a href="qrunnable.html#run">run</a>() function. If autoDelete is enabled
the QRunnable will be deleted when the last thread exits the run
function. Calling <a href="qthreadpool.html#start">QThreadPool.start</a>() multiple times
with the same QRunnable when autoDelete is enabled creates a race
condition and is not recommended.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QRunnable" />QRunnable.__init__ (<i>self</i>)</h3><p>Constructs a <a href="qrunnable.html">QRunnable</a>.
Auto-deletion is enabled by default.</p>
<p><b>See also</b> <a href="qrunnable.html#autoDelete">autoDelete</a>() and <a href="qrunnable.html#setAutoDelete">setAutoDelete</a>().</p>


<h3 class="fn"><a name="QRunnable-2" />QRunnable.__init__ (<i>self</i>, <a href="qrunnable.html">QRunnable</a>)</h3><h3 class="fn"><a name="autoDelete" />bool QRunnable.autoDelete (<i>self</i>)</h3><p>Returns true is auto-deletion is enabled; false otherwise.</p>
<p>If auto-deletion is enabled, <a href="qthreadpool.html">QThreadPool</a> will automatically delete this
runnable after calling <a href="qrunnable.html#run">run</a>();
otherwise, ownership remains with the application programmer.</p>
<p><b>See also</b> <a href="qrunnable.html#setAutoDelete">setAutoDelete</a>() and <a href="qthreadpool.html">QThreadPool</a>.</p>


<h3 class="fn"><a name="run" />QRunnable.run (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Implement this pure virtual function in your subclass.</p>


<h3 class="fn"><a name="setAutoDelete" />QRunnable.setAutoDelete (<i>self</i>, bool&#160;<i>_autoDelete</i>)</h3><p>Enables auto-deletion if <i>autoDelete</i> is true; otherwise
auto-deletion is disabled.</p>
<p>If auto-deletion is enabled, <a href="qthreadpool.html">QThreadPool</a> will automatically delete this
runnable after calling <a href="qrunnable.html#run">run</a>();
otherwise, ownership remains with the application programmer.</p>
<p>Note that this flag must be set before calling <a href="qthreadpool.html#start">QThreadPool.start</a>(). Calling this
function after <a href="qthreadpool.html#start">QThreadPool.start</a>() results in
undefined behavior.</p>
<p><b>See also</b> <a href="qrunnable.html#autoDelete">autoDelete</a>() and <a href="qthreadpool.html">QThreadPool</a>.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>